package com.example.wemedia.controller;

import com.usian.common.constants.message.NewsAutoScanConstants;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 卡夫卡控制器
 *
 */
@RestController
@RequestMapping("/wemedia/news/v1")
public class KafkaController {
    @Autowired
    KafkaTemplate kafkaTemplate;
    
    /**
     * 发送消息
     */
    @GetMapping("send_message")
    public  void sendMessage(Integer id){
        kafkaTemplate.send(NewsAutoScanConstants.WM_NEWS_AUTO_SCAN_TOPIC,id);
    }
}
